﻿<!doctype html>
<html class="no-js" lang="en" xmlns:th="http://www.thymeleaf.org"
      xmlns:layout="http://www.ultraq.net.nz/web/thymeleaf/layout"
      layout:decorate="~{/layout/layout}">
<head>

</head>
<body>
<div id="content" layout:fragment="content">
    <!-- breadcrumb start -->
    <div class="breadcrumb-area">
        <div class="container">
            <ol class="breadcrumb">
                <li><a href="../moban/index.html"><i class="fa fa-home"></i> Home</a></li>
                <li class="active">register</li>
            </ol>
        </div>
    </div>
    <!-- breadcrumb end -->
    <!-- account area start -->
    <div class="account-area pt-30 log">
        <div class="container">
            <div class="row">
                <form action="/user/doReg" method="post" class="layui-form">
                    <div class="form-fields" style="border:1px solid #0c192300;">
                        <h3 style="color:#A62F00;text-align: center;" th:text="${msg}">用户已存在</h3>
                        <h3 style="color:#A62F00;text-align: center;" th:text="${Exception}"></h3>

                        <p>用户名：<span class="required">*</span> <input type="text" name="username" id="username"
                                                                      class="" required/></p>

                        <p>密码<span class="required">*</span><input type="password" name="password"
                                                                   class="" required/></p>
                        <p>E-email<span class="required">*</span><input type="email" id="email" name="email"
                                                                        class="" required/>
                            <input class=" btn-primary"
                                   style="width: 100px;float:right; background-color: #337ab7;margin: 0.5em;"
                                   type="button" value="发送验证码" id="send">
                        </p>

                        <p>验证码：<span class="required">*</span><input type="text" name="verificationCode"
                                                                     class="" required/></p>
                    </div>
                    <div class="form-action">

                        <input value="注册" type="submit">
                    </div>

                </form>
            </div>
        </div>
    </div>
    <!-- account area end -->
</div>

<script layout:fragment="script">
    var config = {pageTitle: "首页", navActive: "navProduct"};
    $(function () {
        document.title = config.pageTitle;
        $("#" + config.navActive).addClass("active");

    })

    //邮箱验证
    $("#send").click(function () {
        var email = $("#email").val();
        $("#send").attr("value", "正在发送");
        $("#send").attr("disabled", "true");
        $.ajax({
            url: "getEmail",
            type: "POST",
            timeout: 5000,
            data: email,
            contentType: 'application/json;charset=UTF-8',
            async: false,
            success: function (data) {
                $("#send").attr("value", "验证码已发送");
            },
            error: function () {
                alert("请重新输入！");
            }
        });
    });
</script>
</body>
</html>

